/******************************************************************************
** 
** Spaces replacer.
** 
** File name:	space_replace.c
** Compilation:	cc space_replace.c -o space_replace
** Execution:	./space_replace
** 
** Description:
** Replaces the sequence that consists of only spaces (one or more) with only 
** one space.
** 
******************************************************************************/
#include <stdio.h>

main()
{
    int c, still_space;
    
    still_space=0;
    while((c = getchar()) != EOF) {
        if (c == ' ') {
            if (still_space == 0) {
                still_space=1;
                putchar(c);
            }   
        }
        if (c != ' ') {
            still_space=0;
            putchar(c);
        }
    }
}

